<template>
  <ul class="catagtory">
    <li
      :class="{ select: currentCatagtory == item.id }"
      v-for="item in catagtory"
      :key="item.id"
      @click="clickTab(item.id)"
    >
      {{ item.name }}
    </li>
  </ul>
</template>
<script>
import { mapGetters } from "vuex";
export default {
  methods: {
    // 点击切换导航,修改分类vuex模块里的mutations的值
    clickTab(id) {
      this.$store.commit("catagtory/updateCurrentCatagtory", id);
    },
  },
  computed: {
    ...mapGetters(["catagtory", "currentCatagtory"]),
  },
};
</script>